#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "tcp/server.h"
#include "crypto/errors.h"

int main()
{
    int fd = TcpServer(NULL, 33303, 10);
    int conn;
    char buffer[4096];
    char ip[40] = {0};
    int ip_len;
    conn = accept(fd, NULL, NULL);
    printf("To client fd: %d\n", conn);
    while (1)
    {
        assert(read(conn, buffer, 4095) >= 0);
        printf("Receive from client: %s\n", buffer);
        scanf("%s", buffer);
        assert(write(conn, buffer, strlen(buffer)));
    }
    return 0;
}